package packets.c2spackets;

import exceptions.MCConnectionException;
import network.MCConnection;
import packets.PacketHandler;
import world.WorldState;


/**
 * 0xfe is a PING to the server.
 * It is used in the Multiplayer overview screen.
 * The server responds with 0xFF STRINGLENGTH SRVMESSAGE 
 */
public class P0xFE extends PacketHandler {

	public P0xFE(WorldState state) {
		super(state);
	}

	@Override
	public void handle(MCConnection conn) throws MCConnectionException {
		
		String motd = "JAMC (Remco)";
		int maxNumberOfPlayers = 3;
		int currentlyOnlinePlayers = 1;
		
		//delimitter: 0xA7 (= §)
		String outputmsg = motd + "§" + currentlyOnlinePlayers + "§" + maxNumberOfPlayers;
		//Response for this message is a client disconnect with the serverinfo appended to it.
		conn.disconnect(outputmsg);
	}

}
